package demo

import (
    "fmt"
	//"wxsdk/wxpay/redpack"
	wxpay "wxsdk/wxpay/wxapp"
	//"github.com/astaxie/beego"
)

func Demo4(){
	appId := "wx82bd84ec09fed74e"
	mchId := "1236027502"
	appKey := "296bed36925b902ce5b78b4dcf755702"
	orderIdStr := "281905019207290880"
	refundNo := "PA17112016391511487"
	payFeeStr := "552"
	refundFeeStr := "552"
	crtStr := `-----BEGIN CERTIFICATE-----
MIIEbDCCA9WgAwIBAgIEAPs5eTANBgkqhkiG9w0BAQUFADCBijELMAkGA1UEBhMC
Q04xEjAQBgNVBAgTCUd1YW5nZG9uZzERMA8GA1UEBxMIU2hlbnpoZW4xEDAOBgNV
BAoTB1RlbmNlbnQxDDAKBgNVBAsTA1dYRzETMBEGA1UEAxMKTW1wYXltY2hDQTEf
MB0GCSqGSIb3DQEJARYQbW1wYXltY2hAdGVuY2VudDAeFw0xNzA1MDkwODI3NDFa
Fw0yNzA1MDcwODI3NDFaMIGbMQswCQYDVQQGEwJDTjESMBAGA1UECBMJR3Vhbmdk
b25nMREwDwYDVQQHEwhTaGVuemhlbjEQMA4GA1UEChMHVGVuY2VudDEOMAwGA1UE
CxMFTU1QYXkxMDAuBgNVBAMUJ+WMl+S6rOWkp+m7hOicguS/oeaBr+enkeaKgOac
iemZkOWFrOWPuDERMA8GA1UEBBMIMTAxNjA0MjEwggEiMA0GCSqGSIb3DQEBAQUA
A4IBDwAwggEKAoIBAQCzQUjMbbw/KWh/FPjO13ILfnLvvogX3IOoLcKqiICM6Lfp
EH1WoOJ495fYxvlt7Di9GfJvnyA5lL2wjIZdx4ZOfziFdKZ67Xj4Pokn5c5hy7vI
d4vZuPD7ucndqGSJkxZY8JX87n8sL/EPKXQhGM+0vO3DFppjdDXxHzSfcFtr/h6T
qFjeIdSU4zz8Tvs3acjxrLNRslQC9dd1qiuU1FQLBLQmpyfWvl2osLp9wk5cIzHs
RSBCYwdEwBueHI1mh9P0tzPezzLbSvksDj+cHqkA7uNonJb1srkbcx/m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02WNzW45tdXodm7R5Htad1p9wpIc
wdc34qTrwN/Es7OXnxlC7q/Wo5jF/L4fJYbp5eDlAoGAIygcUBETzbBPtiXWiX42
X0SvDb8tRE9bpHZJQnIQ6nnr0FrCISjQSmFP7GUwcRbFHez/sZmwpZOiNY5v8ta+
VwwTy4qlH3cKa6OsERxh5GbvN2nI2kcfxLIRpWmY0JMQyttmJ6LKK/hCsXE+qMwc
fWDPWCZGWsZd4fnW4qjtNeM=
-----END PRIVATE KEY-----`
	rsp, err := wxpay.Refund(appId,mchId,"","",appKey,"",orderIdStr,refundNo,
                         payFeeStr,refundFeeStr,crtStr,keyStr)
	if err == nil {
	    fmt.Println("Refund rsp: %#v\n", rsp)
	}else{
	    fmt.Println("Refund error:", err.Error())
	}
	
}

